﻿uniform sampler2D DiffMap;
uniform sampler2D NormMap;
uniform sampler2D SpecMap;

uniform vec4 QuadCol;

uniform vec3 LightPos;
uniform vec3 LightCol;
uniform vec3 LightSpec;
uniform float LightShine;
uniform int BasicMode;

void main(){

	
	
	vec4 diff = texture2D( DiffMap,gl_TexCoord[0].st );
	if(diff.a<0.01){
		discard;
		return;
	}
	if(BasicMode==0){
	vec3 norm = texture2D( NormMap,gl_TexCoord[0].st ).rgb;

	vec3 spec = texture2D( SpecMap,gl_TexCoord[0].st ).rgb;

	norm = -1.0+(norm*2.0);

	vec3 dir = (LightPos-gl_TexCoord[1].xyz); 

	dir = normalize(dir);

	float cv = dot(norm,dir);

	gl_FragColor.rgb = diff*cv*QuadCol.rgb*LightCol;
	gl_FragColor.a = diff.a*QuadCol.a;
	}else{
		gl_FragColor = diff*QuadCol;
	}
}